Skip to content

Conversation

2004shweta
Copy link

Problem: Given an integer array, find the length of the longest path where the absolute difference between consecutive elements is 1. The path does not need to be contiguous.

Category: Dynamic Programming with Hashing

File Added:

src/main/java/com/thealgorithms/dynamicprogramming/LongestConsecutiveDiffPath.java

Features:

Uses a HashMap to track longest paths.

Includes sample test cases in the main method.

Time Complexity: O(n), Space Complexity: O(n)

This problem is unique and not available on LeetCode, making it a valuable addition to the repository.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.54%. Comparing base (c691b31) to head (da2aa64).

Files with missing lines Patch % Lines
...dynamicprogramming/LongestConsecutiveDiffPath.java 0.00% 17 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6723      +/-   ##
============================================
- Coverage     76.60%   76.54%   -0.07%     
  Complexity     6026     6026              
============================================
  Files           719      720       +1     
  Lines         20326    20343      +17     
  Branches       3937     3938       +1     
============================================
  Hits          15571    15571              
- Misses         4164     4181      +17     
  Partials        591      591              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@2004shweta 2004shweta closed this by deleting the head repository Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants